﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FTBS.Models.DAO;

namespace FTBS.Models.BLO
{
    public class CheckOutBLO
    {
        private CheckOutDAO _checkOutDao = new CheckOutDAO();

        /// <summary>
        /// Booking a Ticket method
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="totalPrice"></param>
        /// <param name="totalTicket"></param>
        /// <param name="note"></param>
        /// <param name="chairId"></param>
        /// <param name="scheduleId"></param>
        /// <returns>0: Don't create booking</returns>
        /// <author>???</author>
        public int BookingTicket(string userName, double totalPrice, int totalTicket, string note, string listChairId, int scheduleId)
        {
            try
            {
                string[] strListChair = listChairId.Split(' ');
                List<int> listChair = new List<int>();
                for (int i = 0; i < strListChair.Length; i++)
                {
                    listChair.Add(Convert.ToInt32(strListChair[i]));
                }
                return _checkOutDao.BookingTicket(userName, totalPrice, totalTicket, note, listChair, scheduleId);
            }
            catch (Exception)
            {
                return 0;
            }
        }
    }
}